<?php
/**
 *
 * @revision:   $Id: agsearchverify.php 4 2011-05-29 22:03:39Z agbiggora@gmail.com $
 * @package	    Joomla!
 * @since       {SINCE}
 * @subpackage	AG Search Verify
 * @version     {PROJECTVERSION}
 * @description Small Plugin to make Yahoo, Bing and Google site verification a bit easier.
 *              Works with the Meta Tag method and no template adjustements are needed.
 * @copyright	Copyright © 2010-{PROJECTYEAR} Alexey Gordeyev IK. All rights reserved.
 * @license		GNU General Public License v2.0
 * @author		ALEXEY GORDEYEV IK
 * @author mail	admin@gordejev.lv
 * @website		www.gordejev.lv
 *
 * CODE GENERATED BY: ALEXEY GORDEYEV IK CODE GENERATOR
 * HTTP://WWW.AGJOOMLA.COM/
 *
 *
 * The plugin methods
 * -------------------------------
 * onAfterInitialise()
 *
 */

/* no direct access */
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.plugin.plugin' );

/**
 * Google Verify System Plugin
 *
 * @package	plg_AGSearchVerify
 */
class plgSystemAGSearchVerify extends JPlugin {
   /**
    * Constructor
    *
    * For php4 compatability we must not use the __constructor as a constructor for plugins
    * because func_get_args ( void ) returns a copy of all passed arguments NOT references.
    * This causes problems with cross-referencing necessary for the observer design pattern.
    *
    * @access	protected
    * @param	object		$subject The object to observe
    */
   function plgSystemAGSearchVerify(& $subject, $params) {
      parent::__construct($subject, $params);
   }

   function onAfterInitialise(){

      // Get Plugin info
      $pluginparams = $this->params;
      // get document
      $document	=& JFactory::getDocument();

      // get data
      $google_name     = $pluginparams->get( 'google_name' );
      $google_content  = $pluginparams->get( 'google_key' );

      $yahoo_content   = $pluginparams->get( 'yahoo_key' );
      $bing_content    = $pluginparams->get( 'bing_key' );
      $alexa_content   = $pluginparams->get( 'alexa_key' );
      $yandex_content  = $pluginparams->get( 'yandex_key' );

      $custom_name     = $pluginparams->get( 'custom_name' );
      $custom_content  = $pluginparams->get( 'custom_key' );

      // set meta
      if(!empty($google_content)) { $document->setMetaData($google_name, $google_content); }
      if(!empty($yahoo_content))  { $document->setMetaData("y_key", $yahoo_content); }
      if(!empty($bing_content))   { $document->setMetaData("msvalidate.01", $bing_content); }
      if(!empty($alexa_content))  { $document->setMetaData("alexaverifyid", $alexa_content); }
      if(!empty($yandex_content)) { $document->setMetaData("yandex-verification", $yandex_content); }
      if(!empty($custom_content)) { $document->setMetaData($custom_name, $custom_content); }
       
   }
}
?>